<?php
include ('header.php');

if (!$userIsAdmin) {
    echo 'Ne mozete videti ovu stranicu, nemate privilegije.';
} else {
    $singlePost[0] = array('naslov' => '', 'tekst' => '', 'id' => 0, 'kategorija' => 0);

    if (isset($_GET['p']) && !empty($_GET['p'])) {
        $singlePost = getSinglePost(mres(($_GET['p'])));
    }

    $smarty->assign('singlePost', $singlePost[0]);
    $smarty->assign('categories', getCategories());
    $smarty->assign('postTitles', getAllPostTitles());

    $smarty->display('magazin_admin.tpl');
}
include ('footer.php');
?>
